/*页面局部刷新  by cjl*/
var ajax=
{
	ctx:"",
	multiReq:true,
	processing:false,
	load:function(showResultObjId, _url, paramData, loadingMsg, failedMsg)
	{
		var loadingFunction=function() {$('#'+showResultObjId).html(loadingMsg);};
		var successFunction=function(data, textStatus) {$('#'+showResultObjId).html(data);};
		var errorFunction=function() {$('#'+showResultObjId).html(failedMsg);};
		return this.post(_url, paramData, 'html', loadingFunction, successFunction, errorFunction);
	},
	loadExt:function(showResultObjId, _url, paramData, showLoadingObjId, showFailedObjId)
	{	//div
		var loadingFunction=function(){
			$('#'+showLoadingObjId).show();
			$('#'+showFailedObjId).hide();
		};
		var successFunction=function(data, textStatus, jqXHR) {
			$('#'+showLoadingObjId).hide();
			$('#'+showResultObjId).html(data);
		};
		var errorFunction=function(XMLHttpRequest, textStatus, errorThrown) {$('#'+showLoadingObjId).hide();$('#'+showFailedObjId).show();};
		return this.post(_url, paramData, 'html', loadingFunction, successFunction, errorFunction);
	},
	loadExtByDialog:function(showResultObjId, _url, paramData, showLoadingObjId, showFailedObjId)
	{	//jQuery.dialog
		var loadingFunction=function(){
			$('#'+showLoadingObjId).dialog('open');
			$('#'+showFailedObjId).dialog('close');
		};
		var successFunction=function(data, textStatus, jqXHR) {
			$('#'+showLoadingObjId).dialog('close');
			$('#'+showResultObjId).html(data);
		};
		var errorFunction=function(XMLHttpRequest, textStatus, errorThrown) {
			$('#'+showLoadingObjId).dialog('close');
			$('#'+showFailedObjId).dialog('open');
		};
		return this.post(_url, paramData, 'html', loadingFunction, successFunction, errorFunction);
	},
	post:function(_url, paramData, retDataType, loadingFunction, successFunction, errorFunction)
	{
		if(this.canSubmit())
		{
			this.processing=true;
			loadingFunction();
			$.ajax({
				url : _url,
				timeout : 60000,
				global : false,
				cache : true,
				type : "post",
				data : paramData,
				ifModified:false,
				dataType : retDataType,
				contentType: "application/x-www-form-urlencoded; charset=utf-8",
				success :function(data, textStatus, jqXHR){ajax.processing=false;successFunction(data, textStatus, jqXHR);},
				error : function(XMLHttpRequest, textStatus, errorThrown){ajax.processing=false;errorFunction(XMLHttpRequest, textStatus, errorThrown);}
			});
			return true;
		}
		else
		{
			return false;
		}
	},
	canSubmit:function()
	{
		return (this.multiReq||!this.processing);
	}
}